<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="keywords" content="铜仁商务局管理后台">
    <meta name="description" content="">
    <meta name="author" content="vimi8.com">
    <meta name="renderer" content="webkit">
    <link rel="icon" href="icon.ico">
    <title>铜仁商务局管理后台</title>
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="node_modules/font-awesome/css/font-awesome.min.css">
    <link href="css/common.css" rel="stylesheet">
    <link href="css/showBox.css" rel="stylesheet">
</head>

<body>
<div id="wrapper">
    <div class="ht-top">
        <nav class="ht-navbar" role="navigation">
            <div class="ht-navbar-header">
                <a class="ht-navbar-brand" href="#">铜仁商务局管理后台</a>
            </div>
            <ul class="nav ht-navbar-nav">
                <!--<li class="active"><a href="#">1</a></li>
                <li><a href="#">2</a></li>-->
            </ul>
            <ul class="nav ht-navbar-nav navbar-right">
                <li class="active">
                    <span>下午好</span>&nbsp;&nbsp;
                    <span>ebb</span>&nbsp;&nbsp;
                </li>
                <li>
                    <img src="http://qzapp.qlogo.cn/qzapp/100414805/830A5F805EB7FBC2E1E03D5ADB844CA2/100" width="25"
                         height="25" alt="" class="img-circle">&nbsp;&nbsp;
                </li>
                <li>
                    <a id="logout" title="退出登录" ><i class="fa fa-power-off"></i></a>
                </li>
            </ul>
        </nav>
    </div>
    <div class="ht-content">
        <aside class="ht-aside">
            <ul id="productnav" class="list-unstyled ht-aside-nav">
                <li>
                    <div class="ht-aside-item">
                        <a data-toggle="collapse" href="#collapseThree">
                            <i class="fa fa-sitemap fa-fw"></i> 平台管理
                            <i class="fa fa-angle-down angle"></i>
                        </a>
                    </div>

                    <div id="collapseThree" class="collapse in">
                        <ul class="list-unstyled">
                            <li class="ht-aside-item nl"><a href="index.html"><i class="fa fa-fw fa-code-fork text-muted"></i> 第三方平台</a></li>
                            <li class="ht-aside-item nl"><a href="ebbPlatform.html"><i class="fa fa-fw fa-cogs text-muted"></i> 电商综合服务站</a></li>
                            <li class="ht-aside-item nl"><a href="localEbbPlatform.html"><i class="fa fa-fw fa-cogs text-muted"></i> 电商企业</a></li>
                            <li class="ht-aside-item nl"><a href="selfBuildPlatform.html"><i class="fa fa-fw fa-cogs text-muted"></i> 自建平台</a></li>
                        </ul>
                    </div>
                </li>
                <li>
                    <div class="ht-aside-item">
                        <a href="productManager.html" class="active"><i class="fa fa-product-hunt fa-fw"></i>产品管理</a>
                    </div>

                </li>
                <li>
                    <div class="ht-aside-item">
                        <a href="logisticsManager.html"><i class="fa fa-product-hunt fa-fw"></i> 物流管理</a>
                    </div>
                </li>
                <li>
                    <div class="ht-aside-item">
                        <!--<a href="trainManager.html"><i class="fa fa-product-hunt fa-fw"></i>培训管理</a>-->
                        <a data-toggle="collapse" href="#collapseThree1">
                            <i class="fa fa-sitemap fa-fw"></i> 培训管理
                            <i class="fa fa-angle-down angle"></i>
                        </a>

                    </div>
                    <div id="collapseThree1" class="collapse in">
                        <ul class="list-unstyled">
                            <li class="ht-aside-item nl"><a href="trainManager.html"><i class="fa fa-fw fa-code-fork text-muted"></i> 培训信息</a></li>
                            <li class="ht-aside-item nl"><a href="trainMemberManager.html"><i class="fa fa-fw fa-cogs text-muted"></i> 学员信息</a></li>
                        </ul>
                    </div>
                </li>
                <li>
                    <div id="audit" class="ht-aside-item">
                        <a href="auditManager.html"><i class="fa fa-product-hunt fa-fw"></i> 审核管理</a>
                    </div>
                </li>
                <li id="flag-claim-manage">
                    <div class="ht-aside-item">
                        <!--<a href="trainManager.html"><i class="fa fa-product-hunt fa-fw"></i>培训管理</a>-->
                        <a data-toggle="collapse" href="#collapseThree2">
                            <i class="fa fa-sitemap fa-fw"></i> 认领管理
                            <i class="fa fa-angle-down angle"></i>
                        </a>

                    </div>
                    <div id="collapseThree2" class="collapse in">
                        <ul class="list-unstyled">
                            <li class="ht-aside-item nl"><a href="noRegionList.html"><i class="fa fa-fw fa-code-fork text-muted"></i> 无区县列表</a></li>
                            <li class="ht-aside-item nl"><a href="trainMemberManager.html"><i class="fa fa-fw fa-cogs text-muted"></i> 我的认领记录</a></li>
                        </ul>
                    </div>
                </li>
            </ul>
        </aside>
        <div class="ht-main">
            <div class="ht-title">
                <h3 class="pull-left">产品管理</h3>
                <div class="pull-right">
                    <a class="btn btn-sm" id="export"><i
                            class="fa fa-sign-in"></i> 导出产品信息
                    </a>
                </div>
                <div class="pull-right" id="dr">
                    <a href="" class="btn btn-sm" data-toggle="modal" data-target="#importModal">
                        <i class="fa fa-plus"></i> 导入产品信息
                    </a>
                </div>

                <div class="pull-right">
                    <a class="btn btn-sm" href="addProducts.html"><i class="fa fa-plus"></i> 添加产品</a>
                </div>
            </div>

            <div class="ht-panel">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <form class="form-inline form-filter" role="form">
                            <div class="form-group">
                                <label for="productName">产品名称</label>
                                <input type="text" class="form-control" id="productName" placeholder="请输入产品名称">
                            </div>
                            <div class="form-group" id="hide-address">
                                <label for="productName">区域</label>
                                <select id="addressCode" class="form-control" data-style="btn-primary" value="--选择区域--">

                                </select>

                            </div>
                            <div class="form-group">
                                <label for="platformDateStart">开始时间</label>
                                <input type="text" class="form-control" id="platformDateStart" placeholder="请输入开始时间">
                            </div>
                            <div class="form-group">
                                <label for="platformDateEnd">结束时间</label>
                                <input type="text" class="form-control" id="platformDateEnd" placeholder="请输入结束时间">
                            </div>
                            <!--<div class="form-group">-->
                                <!--<label for="farmName">农场名称</label>-->
                                <!--<input type="text" class="form-control" id="farmName" placeholder="请输入农场名称">-->

                            <!--</div>-->
                            <a href="#" class="btn btn-info" onclick="comments()">提交</a>
                        </form>
                    </div>
                    <table class="table">
                        <thead>
                        <tr>
                            <th style="width: 55px;"><input type="checkbox" name="checkboxAll" onclick="selectall(this)"  value="全选"/>全选</th>
                            <th>产品名称</th>
                            <th>店铺名</th>
                            <th>产品分类</th>
                            <th>销售区域</th>
                            <th>交易量</th>
                            <th>交易额</th>
                            <th>抓取时间</th>
                            <th>销售单价</th>
                            <th>库存量</th>
                            <th>库存单位</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="product-list-data">


                        </tbody>
                        <script id="product-list-tmpl" type="text/x-jsrender">
                            <tr>
                                <td><input type="checkbox" name="check" value="" onclick="selectsub('{{:id}}')" id="{{:id}}"/></td>
                                <td>{{:productName}}</td>
                                <td>{{:electricityBusinessName}}</td>
                                <td>{{:enumCategoryName}}</td>
                                <td>{{:salesArea}}</td>
                                <td>{{:businessVolume}}</td>
                                <td>{{:tradingVolume}}</td>
                                <td>{{:tradingTime}}</td>
                                <td>{{:unitPrice}}</td>
                                <td>{{:stockVolume}}</td>
                                <td>{{:stockUnit}}</td>
                                <td>
                                <a href="updateProducts.html?id={{:id}}" class="btn btn-sm text-info">修改</a>
                                <a href="javascript:void(0);"  onclick="deleteProduct('{{:id}}')" class="btn btn-sm text-danger"> 删除</a>
                                </td>

                            </tr>
                        </script>
                    </table>
                    <div class="panel-footer" style="height: 60px;" id="pagination-bar">
                        <button type="button" class="pull-left btn btn-info" onclick="deleteSelectedAll()" style="margin:0px 30px 0px 0px; ">批量删除</button>
                        <div id="pagination-box" class="pull-left">
                            <ul class="pagination" id="pagination">

                            </ul>
                        </div>

                        <div class="form-inline pull-right">
                            <div class="form-group">
                                <p class="form-control-static">共<span id="product-count">0</span>个产品，<span id="page-total">0</span>页</p>
                            </div>
                            <div class="form-group">
                                <div class="input-group" style="width: 130px;">
                                    <input type="number" min="1" class="form-control" id="page-index">
                                    <span class="input-group-btn">
                                        <button class="btn btn-default" type="button" id="go-index">跳转</button>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="importModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body text-center">
                <p><i class="fa fa-times pull-right" data-dismiss="modal"></i></p>
                <p><i class="fa fa-exclamation-circle" style="font-size:80px;color:#DDB600"></i></p>

                <p>请按 <a href="./templatefile/产品信息模板.xls" style="color:blue;text-decoration:underline">标准格式</a>导入数据，否则可能导致导入失败</p>

                <p style="display:none" id="importing">正在导入。。。</p>
                <form name="imporexcelform" class="form-inline" role="form" enctype="multipart/form-data"
                      style="margin-bottom:80px;margin-top:10px;margin-left:140px;" method="post">
                    <a href="javascript:;" class="file">
                        <input type="file" name="file" id="">
                    </a>

                    <div style="display:none;margin-left:140px;" id="importbtn">
                        <button type="submit" class="btn btn-info" style="width:100px;margin-top:50px;margin-right:120px">导入</button>
                    </div>

                </form>
            </div>

        </div>
    </div>
</div>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/jquery/dist/jquery.form.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="node_modules/jsviews/jsviews.min.js"></script>
<script src="node_modules/twbs-pagination/jquery.twbsPagination.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap-datetimepicker.min.js"></script>
<script src="js/showBox.js"></script>
<script src="js/common.js"></script>
<script src="js/product.js"></script>
<script>
$(window).ready(function () {
    "use strict";
    $.fn.datetimepicker.dates['zh'] = {
        days:       ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六","星期日"],
        daysShort:  ["日", "一", "二", "三", "四", "五", "六","日"],
        daysMin:    ["日", "一", "二", "三", "四", "五", "六","日"],
        months:     ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月","十二月"],
        monthsShort:  ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"],
        meridiem:    ["上午", "下午"],
        //suffix:      ["st", "nd", "rd", "th"],
        today:       "今天"
    };
    $('#platformDateStart').datetimepicker({
        format: 'yyyy-mm-dd',
        language:  'zh',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0,
        showMeridian: 1
    }).on('changeDate', function (ev) {
        $(this).datetimepicker('hide');
    });
$('#platformDateEnd').datetimepicker({
        format: 'yyyy-mm-dd',
        language:  'zh',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0,
        showMeridian: 1
    }).on('changeDate', function (ev) {
        $(this).datetimepicker('hide');
    });
    $(".file").on("change", "input[type='file']", function () {

     if(orgClass!="org_ebb_entity"){
                 ShowTip("你还没有权限做该操作！请联系管理员", "success", 1000);
                 setTimeout(function () {
                      window.location = "productManager.html";
                                        }, 1000);

            }
            var filePath = $(this).val();
            if (filePath.indexOf("xls") != -1 || filePath.indexOf("xlsx") != -1) {
                $(".fileerrorTip").html("").hide();
                var arr = filePath.split('\\');
                var fileName = arr[arr.length - 1];


                $("#importbtn").removeAttr("display");
                $("#importbtn").attr("style", "display:inline");
            } else {
                $(".fileerrorTip").html("您未上传文件，或者您上传文件类型有误！").show();
                return false
            }
        });

        var options = {
            url: '/ebb/entity/product/import',
            type: 'post',
            success: function (data) {
                console.log(data);
                if (!data.error) {
                    $("#importing").attr("style", "display:none");
                    alert("导入成功!");
                    location.reload();
                } else {
                    if (data.errorMessage) {
                        alert(data.errorMessage);
                    }

                }
            }
        };
        var lock = false;
        $("form[name=imporexcelform]").submit(function () {
            if (lock) {
                alert("不能重复提交");
                return;
            }
            lock = true;
                        $(".btn-info").attr('disabled',true); ;
            //$("#importing").removeAattr("style");
            $(this).ajaxSubmit(options);
            return false; //阻止表单默认提交
        });
})
</script>
</body>

</html>
